import { Button, Empty, Space, Radio, Checkbox, InputNumber, Table, Menu, Tabs } from 'antd';
import { useState, useEffect, useContext } from 'react'
import Children from './Children';
import RiskReportContext from '../RiskReportContext';
import useMap from '../../hooks/useMap';
export default function Zhjc(props) {

    const { zhData, zhjcData } = useContext(RiskReportContext);
    const map = useMap();
    const [items, setItems] = useState([
        {
            label: '救援队伍',
            key: 'jydw',
            filter: (item) => {
                return item.name?.indexOf('救援') > -1
            }
        }, {
            label: '避难场所',
            key: 'bncs',
            filter: (item) => {
                return item.name?.indexOf('应急避难所') > -1
            }
        }, {
            label: '物资储备点',
            key: 'wzcbd',
            filter: (item) => {
                return item.name?.indexOf('物资储备') > -1
            }
        }

    ]);


    const handleButtonClick = (record) => {
        //console.log('1',jzzyList);
        // setXqzt(2);
        // setYxfxxq([record, jzzyList]);
        // setZhjcData({ radius: radius, datas: jzzyList })
    }



    if (!zhData) {
        return <div className='layout-v center'>请先选择灾害数据</div> // <Empty description="请先选择灾害数据" image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty>
    }



    return <div>
        <Space direction='vertical' style={{ width: '100%' }}>
            <Tabs items={items.map(item => {
                return {
                    ...item,
                    children: <Children {...props} item={item} onChange={result => {
                        props.onCompleted?.({
                            ...zhjcData,
                            [item.key]: {
                                ...result
                            }
                        })
                    }} />
                }
            })}></Tabs>

        </Space>
    </div>
}